
#ifndef __SQLIST_H
#define __SQLIST_H

#include <iostream>
#include <fstream>
#include <cassert>
#include <cstdlib>
#include "iofile.h"
using namespace std;

#define INCRMSZ     (1024)
template <typename E>
class _sqlist{
public:
    E *elem;
    int len;
    int size;
};

template <typename T>
void sqlist_init(T &sl)
{
    sl.elem = NULL;
    sl.len = 0;
    sl.size = 0;
}

template <typename T, typename E>
void sqlist_create(T &sl)
{
    int n;

    sl.elem = new E[INCRMSZ+1];
    sl.len = 0;
    sl.size = INCRMSZ;

    input >> n;
    for (int i = 1; i <= n; i++){
        input >> sl.elem[i];
        sl.len++;
        //
    }
}

template <typename T>
void sqlist_destory(T &sl)
{
    delete []sl.elem;
    sl.elem = NULL;
    sl.len = 0;
    sl.size = 0;
}

template <typename T>
void sqlist_print(T sl)
{
    for (int i = 1; i <= sl.len; i++){
        cout << sl.elem[i] << " ";
    }
    cout << endl;
}

#endif
